import { request } from '@/sheep/request';
import { CRUD, RECYCLE } from '@/sheep/request/crud';

const route = {
  path: 'coupon',
  name: 'shop.admin.coupon',
  component: () => import('./index.vue'),
  meta: {
    title: '优惠券',
  },
};

const api = {
  ...CRUD('shop/admin/coupon'),
  ...RECYCLE('shop/admin/coupon'),
  select: (params, type = 'page') =>
    request({
      url: `shop/admin/coupon/select?type=${type}`,
      method: 'GET',
      params,
    }),
  send: (id, data) =>
    request({
      url: `shop/admin/coupon/send/${id}`,
      method: 'POST',
      data,
      options: {
        showSuccessMessage: true,
      },
    }),
};

export { route, api };
